package Entities

const (
	PermissionVIP   = 0
	PermissionAdmin = 1
	PermissionUser  = 2
)

type User struct {

	// 基础信息
	Username string `gorm:"type:varchar(100);uniqueIndex;not null" json:"username"`
	Password string `gorm:"type:varchar(255);not null" json:"-"`
	Email    string `gorm:"type:varchar(100);default:'none'" json:"email"`
	Phone    string `gorm:"type:varchar(20);not null" json:"phone"`
	Nickname string `gorm:"type:varchar(255);not null" json:"nickname"`

	// 扩展字段
	Fans       uint   `gorm:"default:0" json:"fans"`
	Permission int    `gorm:"default:2" json:"permission"`
	IsDeleted  bool   `gorm:"default:false" json:"is_deleted"`
	Avatar     string `gorm:"type:varchar(255);default:'http://localhost:8000/getAvatar/default.jpg'" json:"avatar"`
	UID        int    `gorm:"not null;uniqueIndex" json:"uid"`
}

func (User) TableName() string {
	return "users"
}
